<?php

/*
   This program is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation, either version 3 of the License, or
   (at your option) any later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

// Set the content-type
#header("Content-type: text/html");
header("Content-type: image/png");

// Create the image
$w = 1120;
$h = 370+550;
$im = imagecreatetruecolor($w,$h);
$size = 16; //20;

// Create some colors
$white = imagecolorallocate($im, 255, 255, 255);
$grey = imagecolorallocate($im, 128, 128, 128);
$black = imagecolorallocate($im, 0, 0, 0);
imagefilledrectangle($im, 0, 0, $w-1, $h-1, $white);
imagerectangle($im,0,0,$w-1,$h-1,$grey);

// Replace path by your own font path
#$font = 'osifont.ttf';
#$font = '/usr/share/fonts/truetype/msttcorefonts/Arial.ttf';
$font = '/var/www/osifont/osifont.ttf';

// Add some shadow to the text
#$lines = file('lorem_ipsum_big.txt');
$lines = file('pangrams.txt');
for ($i=0;$i<count($lines);$i++) {
	imagettftext($im, $size, 0, 11, 30+25*$i, $black, $font, $lines[$i]);
}
  
//imagerectangle($im,0,0,$w-1,16*($size+26)-5,$grey);


#for ($i=1;$i<20;$i++)
#  imagettftext($im, 9+$i, 0, 10, $i*15+$i*$i, $black, $font, $text);

// Add the text
//imagettftext($im, 20, 0, 10, 20, $black, $font, $text);

// Using imagepng() results in clearer text compared with imagejpeg()
imagepng($im);
imagedestroy($im);
?>

